home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / lang_c / mc51bugs / q32294 < prev    next >
Text File  |  1988-09-26  |  1KB  |  39 lines

  1. Q32294 _Bios_keybrd() Incompatible with CTRL+BREAK Key Combination
  2. C Compiler
  3. 5.10   | 5.10
  4. MS-DOS | OS/2
  5.  
  6. Summary:
  7.  
  8. The example code below demonstrates a problem with the C run-time
  9. function _bios_keybrd and CTRL+BREAK key combination. The routine
  10. works properly until the CTRL+BREAK key combination is executed, at
  11. which time the system locks up and requires a soft reboot. A
  12. workaround comment is provided in the code.
  13.  
  14. The following code demonstrates the problem:
  15.  
  16. #include <bios.h>
  17. #include <stdio.h>
  18. #define kbpress()  _bios_keybrd(_KEYBRD_READY)
  19. #define kbchar()  _bios_keybrd(_KEYBRD_READ)
  20. main()
  21.   {
  22.     unsigned char cchr;
  23.     printf("press any key:\n");
  24.     cchr = ' ';
  25.     do
  26.         {
  27.           if(kbpress())
  28.         /* the insertion of <break;> here alleviates the problem*/
  29.           {cchr = getchar()/*kbchar() & 0x00ff*/;
  30.           printf("\nchar = %c\n",cchr);
  31.           }
  32.         }
  33.     while (cchr!='*');
  34.   }
  35.  
  36.  
  37. Keywords:  buglist5.10
  38. Updated  88/09/27 04:30
  39.